package com.ocean.core.util.enums;

import java.util.Objects;

/**
 * 难度
 *
 * @author zhang
 * @since 2023/10/22
 */
public enum DifficultyEnum {

    /**
     * 初学
     */
    EASY(0, "初学"),

    /**
     * 中级
     */
    NORMAL(1, "中级"),

    /**
     * 高级
     */
    difficulty(2, "高级");

    private Integer key;

    private String value;

    DifficultyEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValueByKey(Integer key) {
        for (DifficultyEnum value : values()) {
            if (Objects.equals(key, value.key)) {
                return value.value;
            }
        }
        return null;
    }
}
